package TimeToWork.Android;

import android.app.Dialog;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;
import android.widget.TextView;

public class AboutDialog extends Dialog {
	
	private static final String TAG = "AboutDialog";
	
	public AboutDialog(Context context) {
		super(context);
		this.setContentView(R.layout.about_dialog);
		this.setTitle("Time To Work");

		/* Get version number from manifest. */
		String version = "Unknown";

		try {
			PackageManager manager = context.getPackageManager();
			PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
			version = info.versionName;
		} catch (Exception e) {
			Log.e(TAG, "Error getting version");
		}

		TextView text = (TextView) this.findViewById(R.id.version);
		text.setText("no: " + version);
	}
}
